# Keyboard Device

Keyboard device configuration contains keyboard name, USB VID/PID, etc, which is the information about your keyboard that appears to the operating system or identifies your device. 

## Basic Configuration

The keyboard device info is defined in `[keyboard]` section of `keyboard.toml`, or `device_config` field in `RmkConfig` struct:

import { Rust, Toml } from '../../components/LangBadge'
import { Tab, Tabs } from '@theme'

<Tabs>
<Tab label={<Toml />}>

```toml title="keyboard.toml"
[keyboard]
name = "My Custom Keyboard"       # Display name
vendor_id = 0x4c4b                # USB vendor ID (16-bit hex)
product_id = 0x4643               # USB product ID (16-bit hex)
manufacturer = "YourName"         # (Optional) Manufacturer string
product_name = "KeyboardName"     # (Optional) Keyboard name, if not set, it will be same as `name` field
serial_number = "vial:f64c2b3c"   # (Optional) Serial number of the keyboard
chip = "nrf52840"                 # Target microcontroller
usb_enable = true                 # (Optional) Enable USB functionality, defaults to `true`
```

</Tab>
<Tab label={<Rust />}>

```rust title="main.rs"

let keyboard_device_config = DeviceConfig {
    vid: 0x4c4b,
    pid: 0x4643,
    manufacturer: "Haobo",
    product_name: "RMK Keyboard",
    serial_number: "vial:f64c2b3c:000001",
};

let rmk_config = RmkConfig {
    device_config: keyboard_device_config,
    // .. Other configurations
};

```

</Tab>
</Tabs>

::: info

To make your keyboard to be recognized by Vial, the `serial_number` shall start with `vial:f64c2b3c:`

:::

## Hardware Selection

You must specify either a `chip` or `board` in `keyboard.toml`, but not both:

**Option 1: Specify Chip**

```toml
[keyboard]
chip = "nrf52840"  # Direct chip specification
```

**Option 2: Specify Board**

```toml
[keyboard]
board = "nice!nano_v2"  # Pre-configured board
```

### Supported Hardware

#### Supported Chips

- **Nordic nRF52 Series**: `nrf52840`, `nrf52833`, `nrf52832`, `nrf52811`, `nrf52810`
- **Espressif ESP32 Series**: `esp32c3`, `esp32c6`, `esp32s3`
- **Raspberry Pi**: `rp2040`, `rp2350`
- **STM32 Series**: Any STM32 chip supported by [embassy-stm32](https://github.com/embassy-rs/embassy/blob/main/embassy-stm32/Cargo.toml) with USB capability

#### Supported Development Boards

- `nice!nano` - nRF52840-based wireless board
- `nice!nano_v2` - Updated version of nice!nano
- `pi_pico_w` - Raspberry Pi Pico W with WiFi/BLE
- `xiao_ble` - Seeed Studio XIAO nRF52840

## USB Configuration

For microcontrollers that lack full USB device functionality (such as the nRF52832 or ESP32-C3), USB support must be explicitly disabled:

```toml
[keyboard]
chip = "nrf52832"
usb_enable = false  # Required for chips without USB
```